package com.teatrace.web.module;

import javax.servlet.http.HttpServletRequest;

import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;

import com.teatrace.model.Product;
import com.teatrace.service.TraceService;
import com.teatrace.webservice.client.WebServiceUtils;

@At("/product")
public class ProductModule {

	@At("/trace")
	@Ok("jsp: /trace")
	public void trace(@Param("productId") String productNum , HttpServletRequest req) {
		TraceService service = (TraceService) WebServiceUtils.getService("traceService");
		Product product = service.getWithTraceInfo(productNum);
		req.setAttribute("product", product);
	}
}
